package com.cdl;

import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.Random;

/**
 * @author cdl
 * @date 2025/9/30
 */
public class Employee {

    private String name;
    private double salary;
    private LocalDate hireDay;
    private static int nextId = 1;
    private int id;

    public static final double PI =3.1415;

    public Employee(String n,double s,int year,int month,int day){
        this.name = n;
        this.salary =s;
        this.hireDay = LocalDate.of(year,month,day);
    }

    public Employee(String n,double s){
        this.name = n;
        this.salary = s;
    }

    public Employee(double s){
        this("Employee #"+ nextId,s);
    }

    public Employee(){

    }

    static {
        Random generator = new Random();
        nextId = generator.nextInt(10000);
    }

    {
        id = nextId;
        nextId++;
    }


    public void setId(){
        id = nextId;
        nextId++;
    }

    public  String  getName(){
        return name;
    }

    public  double getSalary(){
        return salary;

    }

    public int getId(){
        return id;
    }

    public LocalDate getHireDay(){
        return hireDay;
    }

    public  void  raiseSalary(double byPercent){
        double rasie = salary*byPercent/100;
        salary += rasie;
    }

    public void  Test(){
        NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance();
        NumberFormat percentFormatter = NumberFormat.getPercentInstance();
        double x =0.1;
        System.out.println(currencyFormatter.format(x));
        System.out.println(percentFormatter.format(x));
    }




}
